﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace TogglLibrary.DataObjects
{
    public class User
    {
        public string api_token { get; set; }
        public string jquery_date_format { get; set; }
        public string jquery_timeofday_format { get; set; }
        public string date_format { get; set; }
        public int default_workspace_id { get; set; }
        [JsonConverter(typeof(IsoDateTimeConverter))]
        public DateTime updated_at { get; set; }
        public string fullname { get; set; }
        public string language { get; set; }
        public int id { get; set; }
        public int time_entry_retention_days { get; set; }
        public int beginning_of_week { get; set; }
        public bool new_time_entries_start_automatically { get; set; }
        public bool store_start_and_stop_time { get; set; }
        public string email { get; set; }
        public string timeofday_format { get; set; }

        static public User Parse(JToken userResponse)
        {
            JToken userData = userResponse["data"];
            return JsonConvert.DeserializeObject<User>(userData.ToString());
        }
    }

}
